import React, { FC,useMemo } from 'react';
import { View, Text } from '@tarojs/components';
import { styled } from 'linaria/react';
import { useClassName } from '@/utils/index';
import CheckBox from '../CheckBox/CheckBox';
export interface IProps extends ICompProps {
    payText: string;
    isChecked: boolean;
    iconColor: string;
    icon: React.ReactNode;
    onClick:()=>void;
}
PayItem.defaultProps = {} as Partial<IProps>;
function PayItem(props: IProps) {
    const { className, style, payText, isChecked, iconColor, icon, onClick } = props;
    const localClassName = useClassName('PayItem', className);
    const localStyle = useMemo(() => {
        return {
            ...style,
            border:isChecked?'2px solid #ff8828':'2px solid #f5f5f5',
        };
    }, [style, isChecked]);
    return (
        <RootView className={localClassName} style={localStyle} onClick={onClick}>
            <View className="title">
                <Text className="iconfont icon" style={{ color: iconColor }}>
                    {icon}
                </Text>
                <Text className="title">{payText}</Text>
            </View>
            <CheckBox isChecked={isChecked}></CheckBox>
        </RootView>
    );
}
export default React.memo(PayItem as FC<IProps>);
const RootView = styled(View)`
    &.PayItem {
        width: 686px;
        height: 120px;
        border-radius: 16px;
        margin: 0 auto;
        padding: 32px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        .icon {
            font-size: 44px;
        }
        .title {
            font-size: 32px;
            font-weight: 500;
            color: #333333;
            line-height: 44px;
            margin-left: 32px;
        }
    }
`;
